// initialize
currentTime = 0
Initialize the line to " no customers"

while (currentTime <= time of the final event)
{
    if an arrival event occurs at the currentTime 
        process arrival event
    if an departure event occurs at the currentTime
        process departure event

//  an arrival event and an departure event occur at the same time
//  arbitrarily process the arrival event
    currentTime++
}
